<!--
 * @Author: 袁三金
 * @Date: 2024-02-18 15:21:38
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2024-02-20 18:18:32
 * @Description: 请填写简介
-->
<template>
  <div class="file_card">
    <div class="card">
      <div
        class="card_action_btn card_action_left"
        @mouseover="showButtons = true"
        @mouseout="showButtons = false"
        v-bind:class="{ hidden: !showButtons }"
      >
        <input type="checkbox" />
      </div>
      <div
        class="card_action_btn card_action_right"
        @mouseover="showButtons = true"
        @mouseout="showButtons = false"
        v-bind:class="{ hidden: !showButtons }"
      >
        <span class="card_action_list">···</span>
      </div>
      <div class="context_click_menu" @click="handleClick">
        <ul class="context_dropdown_menu">
          <li class="context_dropdown_menu_item">
            <div class="context_dropdown_menu_item_text">下载</div>
          </li>
          <li class="context_dropdown_menu_item">
            <div class="context_dropdown_menu_item_text">收藏</div>
          </li>
          <li style="background-color: rgb(132, 133, 141 , 0.08);height: 1px;margin: 4px 8px;"></li>
          <li class="context_dropdown_menu_item">
            <div class="context_dropdown_menu_item_text">重命名</div>
          </li>
          <li class="context_dropdown_menu_item">
            <div class="context_dropdown_menu_item_text">移动</div>
          </li>
          <li class="context_dropdown_menu_item">
            <div class="context_dropdown_menu_item_text">移至密码箱</div>
          </li>
          <li class="context_dropdown_menu_item">
            <div class="context_dropdown_menu_item_text">移至资源库</div>
          </li>
          <li class="context_dropdown_menu_item">
            <div class="context_dropdown_menu_item_text">查看详细信息</div>
          </li>
          <li style="background-color: rgb(132, 133, 141 , 0.08);height: 1px;margin: 4px 8px;"></li>
          <li class="context_dropdown_menu_item warn">
            <div class="context_dropdown_menu_item_text warn1">放入回收站</div>
          </li>
        </ul>
      </div>
      <div
        class="node_card"
        v-bind:class="{ active: showButtons }"
        @mouseover="showButtons = true"
        @mouseout="showButtons = false"
      >
        <div class="folder_cover">
          <img
            style="width: 115px; height: 90px"
            src="https://img.alicdn.com/imgextra/i1/O1CN01rGJZac1Zn37NL70IT_!!6000000003238-2-tps-230-180.png"
            alt=""
          />
        </div>
        <div class="card_text">
          <p class="card_title">鲁迅</p>
          <p class="card_time">02/16 14:49</p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "FileCardList",
  data() {
    return {
      showButtons: false,
    };
  },
};
</script>

<style lang="scss" scoped>
.file_card {
  width: 155px;
  height: 207px;
  display: flex;
  justify-content: center;
  .card {
    width: 123px;
    position: relative;
    .node_card {
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      cursor: pointer;
      border-radius: 10px;
      padding: 8px 0 10px;
      .folder_cover {
        display: flex;
        justify-content: center;
        align-items: center;
        margin-bottom: 12px;
      }
      .card_text {
        width: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        p {
          width: 100%;
          text-align: center;
        }
        .card_title {
          font-size: 14px;
          color: rgb(37, 38, 43);
          line-height: 1.5;
          margin: 0;
          margin-bottom: 2px;
        }
        .card_time {
          font-size: 12px;
          color: rgb(37, 38, 43, 0.36);
          margin: 0;
        }
      }
    }
    .card_action_btn {
      width: 24px;
      height: 24px;
      border-radius: 3px;
      background-color: #fff;
      cursor: pointer;
      display: flex;
      justify-content: center;
      align-items: center;

      .card_action_list {
        font-weight: 500;
        line-height: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: rgb(37, 38, 43, 0.36);
      }
      .card_action_list:hover {
        color: rgba(10, 10, 10);
      }
    }
    .card_action_btn.hidden {
      display: none;
    }
    .card_action_left {
      position: absolute;
      top: 4px;
      left: 4px;
      z-index: 2;
    }
    .context_click_menu {
      width: 160px;
      padding: 4px;
      background-color: #fff;
      position: absolute;
      top: 34px;
      left: 96px;
      border-radius: 5px;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
      z-index: 2;
      .context_dropdown_menu {
        width: 152px;
        list-style: none;
        padding: 0;
        margin: 0;
        .context_dropdown_menu_item {
          display: flex;
          height: 36px;
          align-items: center;
          border-radius: 5px;
          width: 100%;
          .context_dropdown_menu_item_text {
            color: rgb(37, 38, 43);
            font-size: 14px;
            padding: 0 8px;
            font-family: Helvetica Neue, Helvetica, PingFang SC,
              Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif;
          }
          .context_dropdown_menu_item_text.warn1{
            color: rgb(255, 111, 102);
          }
        }
        .context_dropdown_menu_item:hover {
          background-color: rgb(132, 133, 141, 0.08);
        }
        .context_dropdown_menu_item.warn:hover{
          background-color: rgb(243, 91, 81, 0.12);
        }
      }
    }
    .card_action_right {
      position: absolute;
      top: 4px;
      right: 4px;
      z-index: 2;
    }
    .node_card.active {
      background-color: rgb(132, 133, 141, 0.08);
    }
  }
}
</style>
